package com.mysoft.disconf.web.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baidu.disconf.client.common.annotations.DisconfItem;
import com.mysoft.disconf.conf.SiteConfig;
import com.mysoft.disconf.dao.UserDao;
import com.mysoft.disconf.entity.User;

@Controller
public class MysoftController {

	@Resource
	private SiteConfig siteConfig;
	
	@Resource
	private UserDao userDao;
	
	@RequestMapping(value = "siteConfig")
	@ResponseBody
	public String hello(){
		String n = siteConfig.getSiteName();
		Integer s = siteConfig.getSiteStatus();
		System.out.println("---------------");
		System.out.println(siteConfig.getAppVersion());
		return "{\"result\":\"success\",\"siteName\":\""+ n +"\",\"siteStatus\":\""+ s +"\"}";
	}
	
	@RequestMapping(value = "queryUser")
	@ResponseBody
	public String queryUser(){
		User queryUser = userDao.queryUser(1L);
		System.out.println(queryUser.getEmail());
		System.out.println(queryUser.getName());
		System.out.println(queryUser.getBirthday());
		System.out.println(queryUser.getId());
		
		return "{\"result\":\"success\"}";
	}
	
}
